home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mc51bugs.zip / Q32903 < prev    next >
Text File  |  1988-07-29  |  3KB  |  91 lines

  1. Q32903 Codeview Uses .h File for Source Rather Than .c File
  2. C Compiler
  3. 5.10   | 5.10
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.    In some rare but reproducible situations, the CodeView debugger
  8. uses a file other than the actual source file (in this case, a
  9. header file) as the source listing. Source debugging is impossible
  10. because the source does not correspond to the program counter.
  11.    Very slight changes to the source program correct this problem,
  12. e.g. in one case, moving the final  }  (close brace) of a null
  13. function to the line after the function declaration; in another case,
  14. deleting an unused function prototype declaration corrected the
  15. problem.
  16.    Microsoft has confirmed this to be a problem in Version 5.10 of the
  17. C compiler and in CodeView Version 2.20. We are researching this
  18. problem and will post new information as it becomes available.
  19.  
  20. More information:
  21.    Compile the example below with the following command line, then
  22. start CodeView:
  23.  
  24.    cl /AM /Zi file.c
  25.  
  26.    When CodeView appears, the source on the screen is cvbug.h rather
  27. than cvbug.c.
  28.    If you change the stuff function to put the closing } on the next
  29. line, it works correctly. If you remove the prototype of make an item
  30. from the bottom of cvbug.h, the process works correctly.
  31.    The program below will fail as described above:
  32.  
  33. #include "cvbug.h"
  34.  
  35. void      printf(byte*, ...);
  36. void      stuff(void);
  37. void      main(void);
  38.  
  39. /* If you put the closing } on the next line in the following function,
  40.    everything will work correctly.
  41. */
  42.  
  43. void stuff() { }
  44.  
  45. void main() {
  46.    printf("\nHi there!\n");
  47.    }
  48.  
  49.    The following is the cvbug.h header file:
  50.  
  51. typedef unsigned char byte;
  52. typedef unsigned int  uint;
  53.  
  54. typedef uint               SW;
  55. typedef byte *             POINTER;
  56. typedef short int          DATA;
  57. typedef int                OFFSET;
  58. typedef unsigned char      tiny;
  59.  
  60. #define NULL 0
  61. #define NULLFUNC 0l
  62.  
  63.  
  64. typedef union {
  65.    int i;
  66.    uint ui;
  67.    long l;
  68.    byte *cp;
  69.    tiny ti;
  70.    byte buf[80]; } UNIVERSAL;
  71.  
  72. typedef struct {
  73.    int row, col;
  74.    byte *prompt;
  75.    SW (*convertin)(UNIVERSAL*, byte*);
  76.    void (*convertout)(byte*, UNIVERSAL*);
  77.    POINTER data;
  78.    int maxwidth;
  79.    int datawidth;
  80.    SW (*include)(int);
  81.    int helpnumber;
  82.    int returncode;
  83.    } LISTITEM;
  84.  
  85. void  makeitem(LISTITEM *, int, int, byte*, SW(*)(UNIVERSAL*, byte*),
  86.   void(*)(byte*, UNIVERSAL*), POINTER, int, int, SW(*)(int), int, int);
  87.  
  88.  
  89. Keywords:  buglist5.10
  90. Updated  88/07/29 12:16
  91.